<div class='container'>
  <div class='queued-posts'>
    {{#each ctrl in model itemController='queued-post'}}
      <div class='queued-post'>
        <div class='poster'>
          {{#user-link user=ctrl.post.user}}
            {{avatar ctrl.post.user imageSize="large"}}
          {{/user-link}}

        </div>
        <div class='cooked'>
          <div class='names'>
            <span class="username">
              {{#user-link user=ctrl.post.user}}
                {{ctrl.post.user.username}}
              {{/user-link}}
            </span>
          </div>
          <div class='post-info'>
            <span class='post-date'>{{age-with-tooltip ctrl.post.created_at}}</span>
          </div>
          <div class='clearfix'></div>

          <span class='post-title'>
            {{i18n "queue.topic"}}
            {{#if ctrl.post.topic}}
              {{topic-link ctrl.post.topic}}
            {{else}}
              {{ctrl.post.post_options.title}}
            {{/if}}
            {{category-badge ctrl.post.category}}
          </span>

          <div class='body'>
            {{#if ctrl.editing}}
              {{pagedown-editor value=ctrl.buffered.raw}}
            {{else}}
              {{{cook-text ctrl.post.raw}}}
            {{/if}}
          </div>

          <div class='queue-controls'>
            {{#if ctrl.editing}}
              {{d-button action="confirmEdit"
                         label="queue.confirm"
                         disabled=ctrl.post.isSaving
                         class="btn-primary confirm"}}
              {{d-button action="cancelEdit"
                         label="queue.cancel"
                         icon="times"
                         disabled=ctrl.post.isSaving
                         class="btn-danger cancel"}}
            {{else}}
              {{d-button action="approve"
                         disabled=ctrl.post.isSaving
                         label="queue.approve"
                         icon="check"
                         class="btn-primary approve"}}
              {{d-button action="reject"
                         disabled=ctrl.post.isSaving
                         label="queue.reject"
                         icon="times"
                         class="btn-danger reject"}}
              {{#if ctrl.post.can_delete_user}}
                {{d-button action="deleteUser"
                           disabled=ctrl.post.isSaving
                           label="queue.delete_user"
                           icon="trash"
                           class="btn-danger delete-user"}}
              {{/if}}
              {{d-button action="edit"
                         disabled=ctrl.post.isSaving
                         label="queue.edit"
                         icon="pencil"
                         class="edit"}}
            {{/if}}
          </div>
        </div>
        <div class='clearfix'></div>
      </div>
    {{else}}
      <p>{{i18n "queue.none"}}</p>
    {{/each}}

    {{d-button action="refresh" label="refresh" icon="refresh" disabled=model.refreshing id='refresh-queued'}}
  </div>
</div>
